FROM node as node-build
ARG buildCmd=build
RUN npm install -g pnpm
WORKDIR /app
COPY . .
RUN pnpm install && pnpm run $buildCmd

FROM nginx:stable-alpine
RUN mkdir /app
COPY --from=node-build /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
